<extend name="Public/base" />

<block name="body">
  <!-- 标题栏 -->
  <div class="main-title">
    <h2>拼团活动管理({$_total})</h2>
  </div>
  
  <div class="cf">
    <div class="fl">
      <a class="btn" href="{:U()}">刷 新</a>
    </div>
    <!-- 高级搜索 -->
   <form id="J_search_form" action="{:U('index')}" method="GET">
      <div class="search-form fl cf" style="margin-bottom: 10px;">
        <div class="fl">
          <div class="sleft">
            <select name="status">
              <option value="">活动状态</option>
              <option value="1">正常</option>
              <option value="0">禁用</option>
            </select>
          </div>
          <div class="sleft">
            <select name="time_status">
              <option value="">活动时间状态</option>
              <option value="3">进行中</option>
              <option value="2">已过期</option>
              <option value="1">未开始</option>
            </select>
          </div>
      </div>
      <div class="sleft">
            <input type="text" name="keywords" class="search-input" value="{:I('get.keywords')}" placeholder="活动名称"/>
            <a class="sch-btn" href="javascript:;" id="J_search"><i class="btn-search"></i></a>
          </div>
    </form>
  </div>
  <!-- 数据列表 -->
  <div class="data-table table-striped">
    <table class="">
      <thead>
        <tr>
          <th>活动名称</th>
          <th>活动时间</th>
          <th>拼团限时</th>
          <th>活动状态</th>
          <th width="140" class="text-center">操作</th>
        </tr>
      </thead>
      <tbody>
      <notempty name="lists">
        <volist name="lists" id="vo">
          <tr class="status_trclass_{$vo.status}">
            <td><a href="javascript:void(0)">{$vo.name}</a></td>
            <td>{:time_format($vo['stime'], 'Y-m-d H:i:s')} 至 {:time_format($vo['etime'], 'Y-m-d H:i:s')}</td>
            <td>{$vo['limit'] ? : '不限时'}</td>
            <td>{$vo.status_text}
              <if condition="$vo['stime'] gt NOW_TIME">
                <span class="text-danger">（未开始）</span>
              <else/>
                <if condition="$vo['etime'] gt NOW_TIME">
                  <span class="text-success">（进行中）</span>
                  <else/>
                  <span class="text-cancel">（已过期）</span>
                </if>
              </if></td>
            <td class="text-center">
            <if condition="$vo['etime'] gt NOW_TIME">
              <notempty name="vo.item_ids">
                <a href="{:U('joinItem?type=item&id='.$vo['id'])}">[商品列表]</a>
                <eq name="vo.is_join" value="1"><a href="{:U('orderList?id='.$vo['id'])}">[拼团订单]</a></eq>
              <else/>
                <a href="{:U('joinItem?type=edit&id='.$vo['id'])}">[添加商品]</a>
              </notempty>
            <else />
              <span class="disabled">暂无操作</span>
              <eq name="vo.is_join" value="1"><a href="{:U('orderList?id='.$vo['id'])}">[拼团订单]</a></eq>
            </if>
            </td>
          </tr>
        </volist>
        <else/>
        <td colspan="12" class="text-center"> aOh! 暂时还没有内容! </td>
      </notempty>
      </tbody>
    </table>

  </div>
  <div class="page">
    {$_page}
  </div>
</block>

<block name="script">
  <script type="text/javascript" charset="utf-8">
    //设置单选，复选，下拉菜单的值
      var status = "{:I('get.status')}",time_status = "{:I('get.time_status')}";
      Core.setValue('status', status);
      Core.setValue('time_status', time_status);
    //导航高亮
    highlight_subnav('{:U('index')}');
  </script>
</block>
